#ifndef DW_BASE_BIT_TWIDDLING_H
#	define DW_BASE_BIT_TWIDDLING_H

namespace dw {

//! \brief computes the sign of a value
//! \return -1 if x < T(0), 1 if x > T(0) and 0 otherwise
template< typename T >
T sign(T x)
{
	return (x < T(0) ? T(-1) : (x > T(0) ? T(1) : T(0)));
}

template<>
int32 sign(int32 x)
{
	return (x > 0) - (x < 0);
}

} // namespace dw

#endif // !DW_BASE_BIT_TWIDDLING_H
